<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
    编写函数实现去除任意数组中重复的值
-->

<script>
    var a = [1, 2, 3, 1, 2, 5, 7, 3]

    function removeDuplicates(arr) {
        var newArray = []
        //遍历数组
        for (var i = 0; i < arr.length; i++) {
            //判定新数组中是否已经包含了该数值  没有包含则添加到新数组中
            if (newArray.indexOf(arr[i]) == -1) {
                newArray.push(arr[i])
            }
        }
        return newArray
    }

    var newArr = removeDuplicates(a);
    console.log(newArr);
</script>
</body>
</html>